package com.wgz.medicalmanagement.common.util;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * 密码生成工具类
 */
public class PasswordGenerateUtil {

    public static void main(String[] args) {
        // 创建BCryptPasswordEncoder，使用默认强度10
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        
        // 生成密码哈希
        String password = "admin123";
        String encodedPassword = encoder.encode(password);
        
        System.out.println("原始密码: " + password);
        System.out.println("加密后的密码: " + encodedPassword);
        System.out.println("SQL更新语句: UPDATE sys_user SET password='" + encodedPassword + "' WHERE username='admin';");
        
        // 验证密码
        boolean matches = encoder.matches(password, encodedPassword);
        System.out.println("验证结果: " + matches);
    }
} 